package tw.com.hitevision.whiteboard.android.receivers;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.util.Log;

import tw.com.hitevision.whiteboard.android.MainActivity;
import tw.com.hitevision.whiteboard.android.R;

public class Beijing18AppReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        Log.d("Beijing18AppReceiver", "Beijing18App Action : " + action);
        if (action != null && action.equals(context.getString(R.string.beijing_app_18_vote_image_result))) {
            final Intent i = new Intent(context, MainActivity.class);

            Rect rect = new Rect(
                    intent.getIntExtra("left", 0),
                    intent.getIntExtra("top", 0),
                    intent.getIntExtra("right", 0),
                    intent.getIntExtra("bottom", 0));
            i.putExtra("rect", rect);
            i.putExtra(MainActivity.EXTRA_ANNOTATION_MODE, false);
            i.putExtra(MainActivity.EXTRA_HIDE_APP, false);
            context.startActivity(i);
        }
    }
}
